<div data-role="login_info"></div>
<div class="aw-login-box">
		<div class="mod-body clearfix">
			<h1>欢迎您</h1>
			<h2>开放、自由、与爱同在</h2>
			<div class="content">
				
				<form action="__SELF__" method="post">
					<input type="hidden" name="return_url" value="<?php echo $this->return_url; ?>" />
					<ul>
						<li>
							
							<input type="text" id="inputEmail" class="form-control" placeholder="{:L('_INPUT_PLEASE_')}{$ph}"
                               ajaxurl="/member/checkUserNameUnique.html" errormsg="{:L('_MI_USERNAME_ERROR_')}"
                               nullmsg="{:L('_MI_USERNAME_')}"
                               datatype="*4-32" value="" name="username" autocomplete="off">
						</li>
						<li>
							<input type="password" id="inputPassword" class="form-control"
                                   placeholder="{:L('_NEW_PW_INPUT_')}"
                                   errormsg="{:L('_PW_ERROR_')}" nullmsg="{:L('_PW_INPUT_ERROR_')}" datatype="*6-30" name="password">
						</li>
						<if condition="check_verify_open('login')">
						<li>
	                    <div class="form-group">
	                        <label for="verifyCode" class=".sr-only col-xs-12" style="display: none"></label>
	                        <div class="col-xs-5" style="padding:0;">
	                            <input type="text" id="verifyCode" class="form-control" placeholder="{:L('_VERIFY_CODE_')}" errormsg="{:L('_MI_CODE_NULL_')}" nullmsg="{:L('_MI_CODE_NULL_')}" datatype="*5-5" name="verify">
	                        </div>
	                        <div class="col-xs-7" style="padding:0;">
	                            <img class="verifyimg reloadverify pull-right" alt="{:L('_MI_ALT_')}" src="{:U('verify')}" style="cursor:pointer;max-width: 100%;height:40px;">
	                        </div>
	                        <div class="col-xs-11 Validform_checktip text-warning lg_lf_fm_tip col-sm-offset-1"></div>
	                        <div class="clearfix"></div>
	                    </div>
	                    </li>
	                	</if>
						<li class="last">
							<label class="pull-left">
							<input type="checkbox" name="remember" value="1" style="cursor:pointer;"> 记住我
							</label>
							<input name="from" type="hidden" value="<php>echo $_SERVER['HTTP_REFERER']</php>">
				            <php>
				                session('login_http_referer',$_SERVER['HTTP_REFERER']);
				            </php>
				            <php>if(check_reg_type('email')||check_reg_type('mobile')){</php>
		                    <a href="{:U('Member/mi')}" class="pull-right">{:L('_FORGET_PW_')}{:L('_QUESTION_')}</a>
		                    <php>}</php>
		                    <button type="submit" class="btn btn-large btn-primary" style="width: 320px;">{:L('_LOGIN_SPACE_')}</button>
													
						</li>
						<li>还没有顽瞳账号？ <a href="{:U('ucenter/member/register',array('type'=>'username'))}">创建账号！</a></li>
					</ul>
				</form>
			</div>
			
		</div>
		<div class="mod-footer">
			{:hook('syncLogin')}
		</div>
	</div>

<div class="clearfix"></div>


<script type="text/javascript">
    var quickLogin = "{$login_type}";
    $(document)
            .ajaxStart(function () {
                $("button:submit").addClass("log-in").attr("disabled", true);
            })
            .ajaxStop(function () {
                $("button:submit").removeClass("log-in").attr("disabled", false);
            });

    function change_show(obj) {
        if ($(obj).text().trim() == 'show') {
            var value = $('#inputPassword').val().trim();
            var html = '<input type="text" value="' + value + '" id="inputPassword" class="form-control" placeholder="'+"{:L('_NEW_PW_INPUT_')}"+'" errormsg="'+"{:L('_PW_ERROR_')}"+'" nullmsg="'+"{:L('_PW_INPUT_ERROR_')}"+'" datatype="*6-30" name="password">' +
                    '<div class="input-group-addon"><a style="width: 100%;height: 100%" href="javascript:void(0);" onclick="change_show(this)">hide</a></div>';
            $('#password_block').html(html);
        } else {
            var value = $('#inputPassword').val().trim();
            var html = '<input type="password" value="' + value + '" id="inputPassword" class="form-control" placeholder="'+"{:L('_NEW_PW_INPUT_')}"+'" errormsg="'+"{:L('_PW_ERROR_')}"+'" nullmsg="'+"{:L('_PW_INPUT_ERROR_')}"+'" datatype="*6-30" name="password">' +
                    '<div class="input-group-addon"><a style="width: 100%;height: 100%" href="javascript:void(0);" onclick="change_show(this)">show</a></div>';
            $('#password_block').html(html);
        }
    }

    $(function () {
        $("form").submit(function () {
            toast.showLoading();
            var self = $(this);
            $.post(self.attr("action"), self.serialize(), success, "json");
            return false;
            function success(data) {
                if (data.status) {
                    if (data.url==undefined&&quickLogin == "quickLogin") {
                        $('[data-role="login_info"]').append(data.info);
                        toast.success("{:L('_WELCOME_RETURN_')}{:L('_PERIOD_')}", "{:L('_TIP_GENTLE_')}");
                        setTimeout(function () {
                            window.location.reload();
                        }, 1500);
                    } else {
                        $('body').append(data.info);
                        toast.success("{:L('_WELCOME_RETURN_REDIRECTING_')}", "{:L('_TIP_GENTLE_')}");
                        setTimeout(function () {
                            window.location.href = data.url;
                        }, 1500);
                    }
                } else {
                    toast.error(data.info, "{:L('_TIP_GENTLE_')}");
                    //self.find(".Validform_checktip").text(data.info);
                    //刷新验证码
                    $(".reloadverify").click();
                }
                toast.hideLoading();
            }
        });
        var verifyimg = $(".verifyimg").attr("src");
        $(".reloadverify").click(function () {
            if (verifyimg.indexOf('?') > 0) {
                $(".verifyimg").attr("src", verifyimg + '&random=' + Math.random());
            } else {
                $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
            }
        });
    });
</script>